package com.agritech.factory;

import com.agritech.observer.EnvironmentObserver;
import com.agritech.observer.EnvironmentData;
import lombok.Data;

/**
 * 农机设备抽象类
 */
@Data
public abstract class AgriculturalMachine implements EnvironmentObserver {
    protected String id;
    protected String name;
    protected double latitude;
    protected double longitude;
    protected double fuelLevel;
    protected String status;

    public abstract void startOperation();
    public abstract void stopOperation();
    public abstract void executeTask(String task);

    @Override
    public void update(EnvironmentData data) {
        // 基础环境数据处理逻辑
        System.out.println(name + " 收到环境数据更新：" + data);
        adjustOperationStrategy(data);
    }

    protected abstract void adjustOperationStrategy(EnvironmentData data);
}